package cn.iocoder.an.module.business.dal.mysql.storeinit;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.business.dal.dataobject.storeinit.StoreInitDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.business.controller.admin.storeinit.vo.*;

/**
 * 期初库存台账 Mapper
 *
 * @author zzy
 */
@Mapper
public interface StoreInitMapper extends BaseMapperX<StoreInitDO> {

    default PageResult<StoreInitDO> selectPage(StoreInitPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StoreInitDO>()
                .likeIfPresent(StoreInitDO::getCustomerAccount, reqVO.getCustomerAccount())
                .likeIfPresent(StoreInitDO::getCustomerName, reqVO.getCustomerName())
                .likeIfPresent(StoreInitDO::getStoreLocation, reqVO.getStoreLocation())
                .likeIfPresent(StoreInitDO::getStoreName, reqVO.getStoreName())
                .likeIfPresent(StoreInitDO::getDrawingNumber, reqVO.getDrawingNumber())
                .likeIfPresent(StoreInitDO::getProductName, reqVO.getProductName())
                .eqIfPresent(StoreInitDO::getCurrentAmount, reqVO.getCurrentAmount())
                .betweenIfPresent(StoreInitDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StoreInitDO::getId));
    }

}